package ${PACKAGE_NAME};

import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.eastdigit.servlet.RequestAttribute;
import com.eastdigit.servlet.Response;
import com.eastdigit.servlet.ReqBean;
import ${PARENT_PACKAGE_NAME}.service.${NAME}Service;

@Controller
@RequestMapping(value = "/${LOWER_NAME}")
public class ${NAME}Controller {

    @Autowired
    private ${NAME}Service ${LOWER_NAME}Service;

    /**
     * 查询
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/query")
    @ResponseBody
    public JSONObject query${NAME}(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        return Response.response(${LOWER_NAME}Service.find${NAME}(reqBean));
    }

    /**
     * 添加
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/add")
    @ResponseBody
    public JSONObject add${NAME}(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        ${LOWER_NAME}Service.add${NAME}(reqBean);
        return Response.responseSuccess();
    }

    /**
     * 修改
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/update")
    @ResponseBody
    public JSONObject update${NAME}(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        ${LOWER_NAME}Service.update${NAME}(reqBean);
        return Response.responseSuccess();
    }

    /**
     * 删除
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/delete")
    @ResponseBody
    public JSONObject remove${NAME}(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        ${LOWER_NAME}Service.remove${NAME}(reqBean);
        return Response.responseSuccess();
    }

    //TODO 其他功能
}